package cn.iocoder.yudao.module.im.api.announcement;

import cn.iocoder.yudao.module.im.api.announcement.dto.GroupAnnouncementDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static cn.iocoder.yudao.module.im.api.announcement.GroupAnnouncementApiConstants.*;

/**
 * 群公告服务的 Feign 接口
 *
 * @author 芋道源码
 */
@FeignClient(value = GROUP_ANNOUNCEMENT_SERVICE, contextId = "groupAnnouncement")
public interface GroupAnnouncementService {

    /**
     * 发布群公告
     *
     * @param groupId 群组ID
     * @param title 公告标题
     * @param content 公告内容
     * @param creatorId 创建者ID
     * @return 公告ID
     */
    @PostMapping(PUBLISH_ANNOUNCEMENT)
    Long publishAnnouncement(@RequestParam("groupId") Long groupId, @RequestParam("title") String title, 
                           @RequestParam("content") String content, @RequestParam("creatorId") Long creatorId);

    /**
     * 获取群公告详情
     *
     * @param announcementId 公告ID
     * @return 群公告
     */
    @GetMapping(GET_ANNOUNCEMENT)
    GroupAnnouncementDTO getAnnouncement(@RequestParam("announcementId") Long announcementId);

    /**
     * 获取群组的公告列表
     *
     * @param groupId 群组ID
     * @param pageSize 分页大小
     * @param pageNum 页码
     * @return 公告列表
     */
    @GetMapping(LIST_GROUP_ANNOUNCEMENTS)
    List<GroupAnnouncementDTO> getGroupAnnouncements(@RequestParam("groupId") Long groupId, 
                                                   @RequestParam("pageSize") Integer pageSize, 
                                                   @RequestParam("pageNum") Integer pageNum);

    /**
     * 获取群组的最新公告
     *
     * @param groupId 群组ID
     * @return 最新的群公告
     */
    @GetMapping(GET_LATEST_ANNOUNCEMENT)
    GroupAnnouncementDTO getLatestAnnouncement(@RequestParam("groupId") Long groupId);

    /**
     * 更新群公告
     *
     * @param announcementId 公告ID
     * @param title 公告标题
     * @param content 公告内容
     * @param updaterId 更新者ID
     * @return 是否更新成功
     */
    @PutMapping(UPDATE_ANNOUNCEMENT)
    Boolean updateAnnouncement(@RequestParam("announcementId") Long announcementId, 
                             @RequestParam("title") String title, 
                             @RequestParam("content") String content, 
                             @RequestParam("updaterId") Long updaterId);

    /**
     * 删除群公告
     *
     * @param announcementId 公告ID
     * @param operatorId 操作者ID
     * @return 是否删除成功
     */
    @DeleteMapping(DELETE_ANNOUNCEMENT)
    Boolean deleteAnnouncement(@RequestParam("announcementId") Long announcementId, 
                             @RequestParam("operatorId") Long operatorId);

}